import { defineStore } from 'pinia'
import { ref, computed } from 'vue'
// import { useRoute } from 'vue-router';
import routes from '@/router/routes'

const storeSetup = () => {
  // route
  // const route = useRoute();

  /* 定义数据--------------------------------------------------------------------- */
  // 菜单路由表
  const menuRoutes = ref(routes[1].children)

  // 当前页面路由信息
  const currentRouteInfo = ref()

  // 当前菜单激活index
  const currentMenuActiveIndex = ref('1')

  // 标签历史记录列表
  const tagHistoryList = ref([])

  /* 定义函数--------------------------------------------------------------------- */

  // 返回参数
  return {
    menuRoutes,
    currentRouteInfo,
    currentMenuActiveIndex,
    tagHistoryList
  }
}

// 导出Store
export const useRouterStore = defineStore('router', storeSetup, {
  persist: true
})
